JavaScript
A5.u.objecttoQueryString Method
Syntax
A5.u.object.toQueryString(object[,prefix[,settings]])
Arguments
- objectobject
The object to create the query string from.
- prefixstring
The settings
- settingsobject
The settings object for the query string.
- encodeboolean
If true (the default) then the query string will be encoded.
- booleansobject
The settings for booleans in the query string.
- truthystring
The "true" value to use in the query string. The default is ".t." for Xbasic true.
- falsystring
The "false" value to use in the query string. The default is ".f." for Xbasic false.
Description
Create a query string from an object.
Example
var data = {search: 'Tom', startsWith: true, in: ['Firstname','Lastname']}; var qs = A5.u.object.toQueryString(data); // qs = "search=Tom&startsWith=.t.&in[]=Firstname&in[]=Lastname" var qsJS = A5.u.object.toQueryString(data,'',{booleans: {truthy: 'true', falsy: 'false'}}); // qsJS = ""search=Tom&startsWith=true&in[]=Firstname&in[]=Lastname"